#ifndef __INCkeyMaph
#define __INCkeyMaph
#include <string>
#include <posix.h>

enum MapType
{
    MAP_BEGIN = 0,
    MAP_log   = 0,
    MAP_switch,
    MAP_bool,
    MAP_status,
    MAP_userPermission,
    MAP_COUNT
};

EXTERN_C_BEGIN

const char* value_to_string(MapType map_index, int value);
bool string_to_value(MapType map_index, const std::string& str, int& out);

EXTERN_C_END

#define CONVERT_DESC(_name)                                            \
    inline bool _name##_check_string(const std::string &str, int &out) \
    {                                                                  \
        return string_to_value(MAP_##_name, str, out);                 \
    }                                                                  \
    inline const char *_name##_to_string(int value)                    \
    {                                                                  \
        return value_to_string(MAP_##_name, value);                    \
    }                                                                  \
    inline int _name##_from_string(const std::string &str)             \
    {                                                                  \
        int out = -1;                                                  \
        (void) string_to_value(MAP_##_name, str, out);                 \
        return out;                                                    \
    }

	CONVERT_DESC(log);
	CONVERT_DESC(switch);
	CONVERT_DESC(bool);
    CONVERT_DESC(status);
    CONVERT_DESC(userPermission);


#endif
